﻿using HandyControl.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;
using WcsZz.Extend;
using MessageBox = HandyControl.Controls.MessageBox;

namespace wms_wpf
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : System.Windows.Window
    {
        public MainWindow()
        {
            InitializeComponent();
            EventAggregatorHelper.EventAggregator.ResgiterMessage(arg =>
            {
                if (arg.Message == "false")
                {
                    this.IsEnabled = false;
                }
                else
                {
                    this.IsEnabled = true;
                }

            }, "MainWindow");//选择Setting的消息聚合器

       
        }

        private void Border_MouseDown(object sender, MouseButtonEventArgs e)
        {
            if(e.ChangedButton==MouseButton.Left)
            {
                this.DragMove();
            }

        }


        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            MessageBoxResult msg = MessageBox.Ask("是否关闭");
            if (msg == MessageBoxResult.OK)
            {
                Application.Current.Shutdown();
            }

        }

        private void Mini_Click(object sender, RoutedEventArgs e)
        {
            this.WindowState = WindowState.Minimized;
        }

        private void Max_Click(object sender, RoutedEventArgs e)
        {
            this.WindowState = this.WindowState == WindowState.Maximized ?
           WindowState.Normal : WindowState.Maximized;
        }

   
    }
}
